package com.example.chuyendoinam;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class Chuyennam extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chuyennam);
    }
     
    public void chuyenDoiNam( View view){
    	EditText namduonglich = (EditText) findViewById(R.id.txtnamdl);
    	
    	int namdl= Integer.parseInt(namduonglich.getText().toString());
    	//Toast.makeText(this,"Năm dương lịch: "+namdl, 1000).show();
    	int can = (namdl-3)%10;
		String Cannam="";
		
		switch(can)
		{
		case 0: Cannam= "Qúy"; break;
		case 1: Cannam= "Giáp"; break;
		case 2: Cannam="Ất"; break;
		case 3: Cannam="Bính"; break;
		case 4: Cannam="Đinh"; break;
		case 5: Cannam="Mậu"; break;
		case 6: Cannam="Kỷ"; break;
		case 7: Cannam="Canh"; break;
		case 8: Cannam="Tân"; break;
		case 9:	Cannam="Nhâm"; break;
		}
		int chi = (namdl-3)%12;
		String Chinam="";
		switch(chi)
		{
		case 0: Chinam="Hơi"; break;
		case 1: Chinam="Tý"; break;
		case 2: Chinam="Sửu"; break;
		case 3: Chinam="Dần"; break;
		case 4: Chinam="Mão"; break;
		case 5: Chinam="Thìn"; break;
		case 6:Chinam="Tỵ"; break;
		case 7:Chinam="Ngọ"; break;
		case 8:Chinam="Mùi"; break;
		case 9:	Chinam="Thân"; break;
		case 10:	Chinam="Dậu"; break;
		case 11:	Chinam="Tuất"; break;
		
		}
		//Toast.makeText(this,"Năm âm lịch là: "+Cannam+""+Chinam, 10000).show();
    	TextView namam= (TextView) findViewById(R.id.twnamam);
    	namam.setText("Năm âm lịch là: "+Cannam+" "+Chinam);
    	
    	
    }

   
}
